// ----------------------------------
// RSDK Project: Sonic Essence
// Script Description: Wall Detail
// Script Author: Christian Whitehead/Simon Thomley/Xanman
// Edits by Team ReDream
// ----------------------------------

// Aliases
private alias 22 : TYPE_WALLDETAIL

private alias object.value0 : FLIP_DETAIL


// Function declarations
reserve function WallDetail_DebugDraw
reserve function WallDetail_DebugSpawn

function WallDetail_DebugDraw
	DrawSprite(0)
end function


function WallDetail_DebugSpawn
	CreateTempObject(TypeName[Wall Detail], 0, object.xpos, object.ypos)
	object[tempObjectPos].drawOrder = 6
end function


event ObjectMain
	object.priority = PRIORITY_ACTIVE
end event


event ObjectDraw
	if FLIP_DETAIL == 1
		object.direction = FLIP_X
	end if
		
	DrawSpriteFX(object.propertyvalue, FX_FLIP, object.xpos, object.ypos)
end event


event ObjectStartup
	switch stage.listpos 	// would change this to CheckCurrentStageFolder, later
		case 0
			LoadSpriteSheet("WIZ/Objects.gif")
			// Ring frames

			SpriteFrame(-8, -8, 16, 64, 413,447)
			SpriteFrame(-8, -8, 16, 64, 430,447)
			SpriteFrame(-97,-96, 194, 192, 317, 254)
		break
		case 1
		case 2
		case 3
			LoadSpriteSheet("SSZ/Objects.gif")
			// Ring frames

			SpriteFrame(-8, -8, 16, 128, 1, 383)
			SpriteFrame(-8, -8, 16, 128, 18, 383)
		break
	end switch






	// Add the Ring to the debug mode object list
	SetTableValue(TypeName[Wall Detail], DebugMode_ObjCount, DebugMode_TypesTable)
	SetTableValue(WallDetail_DebugDraw, DebugMode_ObjCount, DebugMode_DrawTable)
	SetTableValue(WallDetail_DebugSpawn, DebugMode_ObjCount, DebugMode_SpawnTable)
	DebugMode_ObjCount++
	
end event

event RSDKDraw
	DrawSprite(0)
end event

event RSDKLoad
	LoadSpriteSheet("Global/Display.gif")
	SpriteFrame(-16, -16, 32, 32, 1, 143)
end event
